<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>02_CSS选择器</title>
    <style>
        h4 {
            color: red;
        }

        #d1 {
            color: blue;
            width: 100px;
            height: 100px;
            background-color: pink;
            border: 5px solid purple;
        }

        .success {
            background-color: green;
        }

        .error {
            background-color: red;
        }
        .msg {
            background-color: white;
            border: 5px solid black;
        }
        #d2 span {
            background-color: yellow;
        }
        #d2>div>p>span {
            color: red;
        }
        h4,#d2,.error {
            border: 3px solid cyan;
        }
        * {
            font-style: italic;
        }

    </style>
</head>
<body>
    <div id="d1">我是div</div>

    <div>我是div</div>

    <p>我是段落</p>

    <h4>我是标题</h4>
    <h4>我是标题</h4>

    <span class="error msg">用户名已被占用</span>
    <span class="error msg">两次密码不一致</span>
    <span class="error msg">手机号格式不正确</span>
        <br>
    <span class="success msg">有效的邮箱</span>
    <span class="success msg">用户名可以使用</span>
    <span class="success msg">有效的年龄</span>
    <hr>
    <br>

    <div id="d2">
        <span>111</span>
        <div>
            <span>222</span>
            <p>测试文字</p>
            <p>测试<span>333</span>文字</p>
        </div>
        <span>444</span>

    </div>
</body>
</html>